using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Runtime.InteropServices;

namespace Dragoon.RoboBattle.HIC
{
    class MeasureFrame : VectorGeometryColored
    {
        public MeasureFrame(Game g) : base(g) { }

        private void Line(Vector3 p1, Vector3 p2, float h)
        {
            p1.Y = p2.Y = h;
            BuildLine(p1, p2, 0.2f, 4);
        }

        private void Square(Vector3 p1, Vector3 p3, float h)
        {
            var d = p3 - p1;
            var p2 = p1 + d * Vector3.Right;
            var p4 = p1 - d * Vector3.Forward;
            
            Line(p1, p2, h );
            Line(p2, p3, h);
            Line(p3, p4, h);
            Line(p4, p1, h);
            
        }

        public override void Initialize()
        {
            base.Initialize();
            BuildStart();
            Square(Measurements.TerrainNorthEast, Measurements.TerrainSouthWest, 
                Measurements.TerrainMinHeight);
            Square(Measurements.TerrainNorthEast, Measurements.TerrainSouthWest,
                Measurements.TerrainMaxHeight);
            BuildEnd();
        }
    }
}

